DeskEdit 4

An advanced all-purpose program and text editor for Acorn 32-bit Computers

Supplement: Upgrading from DeskEdit 3


Installation

The new version of DeskEdit supplied on the accompanying disc is complete in all respects, and may be run directly from the disc, or preferably installed on your hard disc. To do this, simply drag DeskEdit from the floppy to the directory of your choice. The copies of Find and Dustbin which accompany the package are unchanged from DeskEdit 3.

If you wish to retain the settings of the various choice files from your earlier version of DeskEdit, you should proceed as follows. First move your working copy of DeskEdit 3 to somewhere safe, and install DeskEdit 4 in the manner described above. Now open the application directories of both DeskEdit 3 and 4 (by Shift-double-clicking on their icons in the directory viewer). Now simply drag the Choices and the Data directories from DeskEdit 3 to DeskEdit 4, and the job is done.

The one drawback to the above is that it will overwrite DeskEdit 4's Overrides file with your current DeskEdit 3 Overrides. The new file contains details of two new Overrides (related to printer use). To reinstate them, simply add the following two lines to your DeskEdit 3 Override file:

Insert them near the end of the file, immediately before the line:

If you want to bring either of these features into play, you will need to remove the initial slash.

New Features

DeskEdit 4 contains a number of significant enhancements which make it even more powerful than its predecessor. The menu structure has also been altered to make the main window menu more compact, placing a number of features in the new submenu entry, Misc edit. The major new features are as follows:

Task Windows

Task windows can be handy in lots of ways, and are now implemented with DeskEdit 4. They work in a similar way to Edit, but with a number of very useful extra features. To create a task window, either install DeskEdit and select Task Window from the icon bar menu, or simply press Ctrl-F12 in the normal way. This will load DeskEdit if it is not already on the icon bar, and open a task window. If Edit loads onto the icon bar instead, it is simply that DeskEdit has not yet been seen by the Filer - so open a directory containing DeskEdit, and press Ctrl-F12 again.

From a DeskEdit task window you can do all the normal things, like make a system call (e.g. type Cat to catalogue your current directory). Additionally the function keys F1 to F8 are available as programmable keys. Function keys F9 to F11 behave as they normally do in DeskEdit, so you can place markers and so on without having to unlink the task window first.

You will also find that the cursor keys are active in DeskEdit task windows (they are not in Edit), so it is easy to move around and look at parts of the window that have scrolled out of view. All Ctrl keys are also active - so you can mark a line with Ctrl-Sh-M for example as you would normally in a DeskEdit window.

Additionally the normal copy editing and the clipboard are continually active, and accessible directly from the keyboard. This means that if you are testing out a command - e.g. a sound command, you do not need to retype it every time - just mark it either with the mouse, or with Ctrl-M or Ctrl-Sh-M, then press Ctrl-B or Ctrl-C to copy it down to the command line. And if the line contains a carriage return - as it would if you selected it with Ctrl-Sh-M or treble-clicked with the mouse - then the line will not only be copied, it will also be automatically executed. You can also copy from any other DeskEdit window in this way.

You can even execute all the commands in an Obey file by dragging it to the task window directly from the Filer.

Clever Boots

You can boot up with one or more task windows open by including the switch "-tw" in the list of files. The "-tw" can be anywhere in the list, so you can choose where you want the window in the stack. For example, you might put the following line in a desktop boot file:
This would boot your machine with DeskEdit on the icon bar, and with two DeskEdit windows open, one containing the file Letter, the other a task window.

You can even send your own user commands to a task window (one will be opened if there is none available). To do this, use the w command in your list of user commands in the file !DeskEdit.Data.Commands - e.g.:

or:

Save and Run

DeskEdit already implements save and run for Basic programs - just save with Ctrl-Sh-F3. If you are editing an Obey file or an Exec file, saving with Ctrl-Sh-F3 will cause the file to be saved as normal, but will now also execute the saved file in a task window, creating a new one if none is open.

Performing a Ctrl-Sh-F3 save when in C mode works similarly, except that here, DeskEdit searches the first few lines of the source file for the name of a file to run - which could be a Make file, or better still, an Exec or Obey file which controls the Make process. The keyword task_window is used, as in the example below:

This will cause the named file to be run from a task window (creating a new one if one is not already open).

As an added bonus, you can also include the switch -b, to send the current window to the back of the stack. This puts it out of the way until you need it (Ctrl-Sh-Enter will bring it back again). With the switch the above example becomes:

Key Macros - Keystroke Recording

A system of recording DeskEdit keystrokes has been built into DeskEdit 4. Sequences can then be played back to implement repetitive tasks. The macros can be controlled from function key Ctrl-F7 (or from the Key macro entry on the Misc edit submenu), which brings up a dialogue box, or from a set of 10 special key combinations.

There are ten available macro buffers for each of DeskEdit's three languages (Text, Basic and C). Each of these can be given a textual label to assist in remembering the function you have assigned to it, and each can accommodate up to 50 keypresses. All keystroke macros can be saved directly from the Save button on the Macros dialogue box.

The ten macros are associated with the letters Q-P on the second row of the keyboard. Use Esc-Sh-<key> to toggle recording on/off, and Esc-<key> to play back a macro at any time.

Thus for example if you press Escape-Sh-Q, the "Q" macro will start recording every keypress. Press the Down cursor key 3 times, then hit Escape-Sh-Q (or any other macro key since these all cancel recording), and you will have recorded a sequence of three Cursor-down movements. To use these at any time, just hit Escape-Q.

You can also control the process from the dialogue box on Ctrl-F7. Press Ctrl-F7 to display the box (or select it from the Misc edit submenu), then click on Q to select this as the current macro. You can optionally type in a memorable name of up to 11 characters (e.g. 3xCursorDwn). Click on Record to start recording, and then press Cursor down three times. Press Ctrl-F7 to stop the recording. The dialogue box will now show the length of the recording under Q. It should be 3.

Clicking on Playback will play the selected macro, while clicking on Save will save your macros to disc.

This new macro facility is very powerful, though there is just one thing that you cannot yet do with it: it will not record the keys typed into any dialogue box. If there is sufficient demand this feature may be included in a future release.

Two Examples
As a first example, here is how to create a macro which will cause any word at the caret to be given italics codes. Place the caret in the middle of any word in a text file in text mode. Now start recording a key macro, and use the following four keys in sequence:

<Right-hand-Shift><Left-Cursor>(new feature - see later)
Ctrl-I
<Right-hand-Shift><Right-Cursor>(new feature - see later)
Ctrl-O

Now stop recording. Now whenever you play back this macro, the word at the caret (regardless of exactly where the caret is in the word) will receive an Italics on code at the start, and an All Codes Off code at the end. It will even work if the word is immediately followed by some form of punctuation. By a similar process you can create a macro to remove such a pair of codes, though if you apply it to a word without codes, it will simply remove the first and last letter of the word.

The second example shows how to use a macro in conjunction with a Quick-search. Suppose you want to find occurrences of variables containing the sequence _paint, and add to them the sequence my_ at the start - so that xx_paint_loader and load_paint_brush would become my_xx_paint_loader and my_load_paint_brush. This is tricky to do using Find on F4, and anyway the wildcard specifiers in Find can be pretty cumbersome. So, to use Quick-search, just initiate a Quick-search using Ctrl-F, and search for _paint. This should take you to a find. Now start recording a macro, and use the following five keys:

<Right-hand-Shift><Left-Cursor>(new feature - see later)
m
y
_(underscore)
Ctrl-N

Then stop recording.

Now every time you play back this macro it will amend the variable at the caret, and move you on to the next find. If you want to alter this find, play the macro again, or if you want to just move on to the next find without altering the current one, press Ctrl-N.

Note the way that we have put the Ctrl-N at the end of the macro sequence, to give us the option of rejecting the replace.

Auto-finder for Basic Errors

DeskEdit 4 now provides a mechanism for taking you straight to reported error lines in Basic. To make it work you must include the following short statement in your error handler:
This has been set up as a Basic text macro for ease of use on Ctrl-1 (use the left-hand Ctrl key with the numeric keypad). The way it works is to set the system variable DeskEdit$ERL to the error line number.

Once your program hits an error, just press Ctrl-G (for Goto Error Line), in the DeskEdit window containing the source file, and you will be taken to the error line. And this works regardless of whether your program is neatly numbered by tens or not. Note that DeskEdit's throwback window must be closed for this to work, since Ctrl-G is also used to take you to the next throwback line.

The new invisible marker on Escape-G will take you back to where you were before you issued a Ctrl-G.

A General Go-to

A second system variable:
has been set aside for the user. It works in a similar way to the Basic Error line finder above, but it operates from Ctrl-Sh-G, and is active in all of DeskEdit's three languages (Text, Basic and C). Note that it will only operate when DeskEdit's throwback window is closed, because when it is open Ctrl-Sh-G takes you to the next throwback line (upwards through the file).

To make it work, simply set this variable to the line number required, and then press Ctrl-Sh-G in any window to go to that line number. One use for this would be in Basic or C programs which handle data or text files. Your program could check through a data file, and if it came to an error, it could report the error in the normal way, but also set DeskEdit$goto to the line number in the data file where the data needs editing. All you do then is press Ctrl-Sh-G from the DeskEdit window holding the data file, and you will be taken straight to the error line. There are I am sure, many other uses for this trick, and if you come across any interesting ones, please write in.

The new invisible marker on Escape-G will take you back to where you were before you issued a Ctrl-Sh-G.

Quick-search Wild Cards

Up to now DeskEdit's Quick-search has always assumed a wildcard at the start and end of each entered string. With DeskEdit 4 this is now controlled by option icons in the Quick-search dialogue box, and the state of these two options is saved with a Choices save (from the icon bar menu).

The new non-wildcard search has been implemented in a special way to assist programmers in both C and Basic who want to search for particular variable names etc. (though it will also be useful in Text mode). It is designed to enable you to find, for example, all references to the variable i without finding anything else which happens to contain the letter i.

Thus for example in earlier Quick-searches, if you opted to search for i, you would get every word with i in it. By turning off the wildcards at the start and end of the search string you can specify a search for i on its own, and this will find all cases where the variable name i has been used, including:

but excluding PROCi, my_i and ii etc.

In Basic it is currently fooled by placing variable names immediately adjacent to Basic keywords, as in:

Extended Info on Replay and Squash Files

Two more file types have been added to those on which DeskEdit gives Extended Info. Just drag a Replay or a Squash file to DeskEdit's icon on the icon bar with Alt-Shift pressed to get a full info listing. This is very handy for these two file types because although Replay files contain a wealth of information in their header, the files are often too large (many megabytes) to load into a text editor to read directly. With Squash files, the extended info includes the original filetype and datestamp, together with the current and original file length.

Printer Fixes

DeskEdit 4 contains two new overrides to help with the problem of excess pages being printed with some of the RISC OS 3 printer drivers.

The override printer_formfeeds can now be set to "yes". This simply replaces the very last line-feed on each page with a page-feed. This (somewhat paradoxically) avoids the problem with some drivers which resulted in double page feeds. The earlier solution of using artificially long page lengths is now redundant, so the driver page size should now be set to exactly match the size in DeskEdit's Page set up dialogue box.

Additionally the override printer_endfeeds can be set to "no" to stop the last page being pushed out. The drivers normally issue a page feed as part of the end of job sequence, so this avoids a double page at the end.

To set these overrides, you will need to load the file DeskEdit$Choices.Overrides into DeskEdit, and remove the leading slash from the lines:

New Key Combinations Introduced in DeskEdit 4

The key for centring text has now been moved from Escape-R to Ctrl-Sh-K to leave room for the new macro recording keys.

Two new key combinations have been implemented to move the caret to the start or end of a word. This is particularly useful for including in Key macros etc, and takes account of punctuation. The keys, which use the Right-hand Shift key in conjunction with the Left or Right cursor keys are:
<Right-hand-Shift><Left-Cursor>Go to start of word
<Right-hand-Shift><Right-Cursor>Go to end of word

The new key combination:

can be used to right-align comments in C source code. Thus the lines:

int i; /* loop variable */
char string[100]; /* temporary string */
dbox d; /* prog info dialogue box */

would become:

int i;/* loop variable */
char string[100];/* temporary string */
dbox d;/* prog info dialogue box */

after pressing Escape-Tab three times (since it moves on to the next line after alignment), and it doesn't matter where on the line the caret is positioned. It takes the length of the line from the width as set on Escape-F5.

Escape-G Marker
A new invisible marker on Escape-G will take you back to where you were before you issued a Ctrl-G or a Ctrl-Sh-G. This will prove very useful if you are using the key to take you to a throwback line or an error line in Basic.

C++
DeskEdit 4 now fully supports the C++ convention of using a double slash to indicate that the rest of the line is to be ignored. To set up DeskEdit 4 for use with C++ remarks, Menu over Language and C from the window menu on a C source, and click on "C++". To ensure that DeskEdit starts with this option as default, perform a Choices save via the main menu.

DeskEdit 4 also incorporates a number of minor bug fixes and improvements, including the following:

  1. Filtered extended saves now do an extended save.
  2. Attempting to load a file from an absent disc, doesn't create a new incarnation of DeskEdit.
  3. Routines to put text into upper or lower case have been improved to leave chars <48 or >122 untouched.
  4. Sh-F11 now does a Home & Find (as it should always have done), rather than a marked find.

Copyright © Lee Calcraft 1994

Published by BEEBUG Ltd, 117 Hatfield Road, St Albans, Herts AL1 4JS. Tel. 0727 840303